package com.loongtech.bi.manager.player;

import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;

import com.loongtech.bi.entity.player.EntityUserSevenLoss;
import com.loongtech.core.jpa.manager.ManagerQueryCacheBase;
/**
 * 用户的三日流失
 * @author lihui
 *
 */
@Service
public class UserSevenLossManager extends ManagerQueryCacheBase<EntityUserSevenLoss> {
	private static final long serialVersionUID = 1L;
	
	/**
	 * 根据开始结束时间查询某个维度的数值
	 * @param dateStart
	 * @param dateEnd
	 * @return
	 */
	public List<Object[]> getUserSevenLossByAllKind(Date dateStart, Date dateEnd,String queryPlatform, String queryChannel, String queryServer) {
		return findByQuery("select date_format(day,'%Y-%m-%d'),sum(unloginusernum) * 1.0 / sum(usercreatenum) from EntityUserSevenLoss where day>=:dayStart and day<=:dayEnd and platformid = '"+queryPlatform+"' and channelid = '"+queryChannel+"' and serverid = '"+queryServer+"' and unloginusernum is not null and usercreatenum is not null  group by day order by day desc", "dayStart", dateStart, "dayEnd", dateEnd);
	}
}
